home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / ldapjdk.jar / netscape / ldap / LDAPException.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-04-13  |  4.8 KB  |  157 lines

  1. package netscape.ldap;
  2.  
  3. import java.io.IOException;
  4. import java.util.Hashtable;
  5. import java.util.Locale;
  6. import java.util.PropertyResourceBundle;
  7.  
  8. public class LDAPException extends Exception {
  9.    public static final int SUCCESS = 0;
  10.    public static final int OPERATION_ERROR = 1;
  11.    public static final int PROTOCOL_ERROR = 2;
  12.    public static final int TIME_LIMIT_EXCEEDED = 3;
  13.    public static final int SIZE_LIMIT_EXCEEDED = 4;
  14.    public static final int COMPARE_FALSE = 5;
  15.    public static final int COMPARE_TRUE = 6;
  16.    public static final int AUTH_METHOD_NOT_SUPPORTED = 7;
  17.    public static final int STRONG_AUTH_REQUIRED = 8;
  18.    public static final int LDAP_PARTIAL_RESULTS = 9;
  19.    public static final int REFERRAL = 10;
  20.    public static final int ADMIN_LIMIT_EXCEEDED = 11;
  21.    public static final int UNAVAILABLE_CRITICAL_EXTENSION = 12;
  22.    public static final int CONFIDENTIALITY_REQUIRED = 13;
  23.    public static final int SASL_BIND_IN_PROGRESS = 14;
  24.    public static final int NO_SUCH_ATTRIBUTE = 16;
  25.    public static final int UNDEFINED_ATTRIBUTE_TYPE = 17;
  26.    public static final int INAPPROPRIATE_MATCHING = 18;
  27.    public static final int CONSTRAINT_VIOLATION = 19;
  28.    public static final int ATTRIBUTE_OR_VALUE_EXISTS = 20;
  29.    public static final int INVALID_ATTRIBUTE_SYNTAX = 21;
  30.    public static final int NO_SUCH_OBJECT = 32;
  31.    public static final int ALIAS_PROBLEM = 33;
  32.    public static final int INVALID_DN_SYNTAX = 34;
  33.    public static final int IS_LEAF = 35;
  34.    public static final int ALIAS_DEREFERENCING_PROBLEM = 36;
  35.    public static final int INAPPROPRIATE_AUTHENTICATION = 48;
  36.    public static final int INVALID_CREDENTIALS = 49;
  37.    public static final int INSUFFICIENT_ACCESS_RIGHTS = 50;
  38.    public static final int BUSY = 51;
  39.    public static final int UNAVAILABLE = 52;
  40.    public static final int UNWILLING_TO_PERFORM = 53;
  41.    public static final int LOOP_DETECT = 54;
  42.    public static final int SORT_CONTROL_MISSING = 60;
  43.    public static final int INDEX_RANGE_ERROR = 61;
  44.    public static final int NAMING_VIOLATION = 64;
  45.    public static final int OBJECT_CLASS_VIOLATION = 65;
  46.    public static final int NOT_ALLOWED_ON_NONLEAF = 66;
  47.    public static final int NOT_ALLOWED_ON_RDN = 67;
  48.    public static final int ENTRY_ALREADY_EXISTS = 68;
  49.    public static final int OBJECT_CLASS_MODS_PROHIBITED = 69;
  50.    public static final int AFFECTS_MULTIPLE_DSAS = 71;
  51.    public static final int OTHER = 80;
  52.    public static final int SERVER_DOWN = 81;
  53.    public static final int PARAM_ERROR = 89;
  54.    public static final int CONNECT_ERROR = 91;
  55.    public static final int LDAP_NOT_SUPPORTED = 92;
  56.    public static final int CONTROL_NOT_FOUND = 93;
  57.    public static final int NO_RESULTS_RETURNED = 94;
  58.    public static final int MORE_RESULTS_TO_RETURN = 95;
  59.    public static final int CLIENT_LOOP = 96;
  60.    public static final int REFERRAL_LIMIT_EXCEEDED = 97;
  61.    private int resultCode = -1;
  62.    private String errorMessage;
  63.    private String matchedDN;
  64.    private Locale m_locale = Locale.getDefault();
  65.    private static Hashtable cacheResource = new Hashtable();
  66.    private static final String baseName = "netscape/ldap/errors/ErrorCodes";
  67.  
  68.    public LDAPException() {
  69.    }
  70.  
  71.    public LDAPException(String var1) {
  72.       super(var1);
  73.    }
  74.  
  75.    public LDAPException(String var1, int var2) {
  76.       super(var1);
  77.       this.resultCode = var2;
  78.    }
  79.  
  80.    public LDAPException(String var1, int var2, String var3) {
  81.       super(var1);
  82.       this.resultCode = var2;
  83.       this.errorMessage = var3;
  84.    }
  85.  
  86.    public LDAPException(String var1, int var2, String var3, String var4) {
  87.       super(var1);
  88.       this.resultCode = var2;
  89.       this.errorMessage = var3;
  90.       this.matchedDN = var4;
  91.    }
  92.  
  93.    public int getLDAPResultCode() {
  94.       return this.resultCode;
  95.    }
  96.  
  97.    public String getLDAPErrorMessage() {
  98.       return this.errorMessage;
  99.    }
  100.  
  101.    public String getMatchedDN() {
  102.       return this.matchedDN;
  103.    }
  104.  
  105.    public String toString() {
  106.       String var1 = super.toString() + " (" + this.resultCode + ")";
  107.       if (this.errorMessage != null && this.errorMessage.length() > 0) {
  108.          var1 = var1 + "; " + this.errorMessage;
  109.       }
  110.  
  111.       if (this.matchedDN != null && this.matchedDN.length() > 0) {
  112.          var1 = var1 + "; matchedDN = " + this.matchedDN;
  113.       }
  114.  
  115.       Object var2 = null;
  116.       String var3;
  117.       if ((var3 = this.errorCodeToString(this.m_locale)) != null && var3.length() > 0) {
  118.          var1 = var1 + "; " + var3;
  119.       }
  120.  
  121.       return var1;
  122.    }
  123.  
  124.    public String errorCodeToString() {
  125.       return errorCodeToString(this.resultCode, this.m_locale);
  126.    }
  127.  
  128.    public String errorCodeToString(Locale var1) {
  129.       return errorCodeToString(this.resultCode, var1);
  130.    }
  131.  
  132.    public static String errorCodeToString(int var0) {
  133.       return errorCodeToString(var0, Locale.getDefault());
  134.    }
  135.  
  136.    public static synchronized String errorCodeToString(int var0, Locale var1) {
  137.       try {
  138.          String var2 = var1.toString();
  139.          PropertyResourceBundle var3 = (PropertyResourceBundle)cacheResource.get(var2);
  140.          if (var3 == null) {
  141.             var3 = LDAPResourceBundle.getBundle("netscape/ldap/errors/ErrorCodes", Locale.getDefault());
  142.             if (var3 != null) {
  143.                cacheResource.put(var2, var3);
  144.             }
  145.          }
  146.  
  147.          if (var3 != null) {
  148.             return (String)var3.handleGetObject(Integer.toString(var0));
  149.          }
  150.       } catch (IOException var4) {
  151.          System.out.println("Cannot open resource file for LDAPException netscape/ldap/errors/ErrorCodes");
  152.       }
  153.  
  154.       return null;
  155.    }
  156. }
  157.